<?php

namespace App\Http\Controllers\Test;

use App\Http\Controllers\ApiController;
use App\Repositories\Category\CategoryFactory;
use App\Repositories\Distribution\DistributionTimeRepositoryEloquent;
use App\Services\Address\DeliverRegionOrderPeakService;
use App\Services\Distribution\OrderDistributionTimeService;
use App\Services\Goods\GoodsSearchService;
use App\Services\Goods\OpenSearchService;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\DB;
use Prettus\Validator\Contracts\ValidatorInterface;
use Prettus\Validator\Exceptions\ValidatorException;
use App\Http\Requests\PostCreateRequest;
use App\Http\Requests\PostUpdateRequest;
use App\Repositories\PostRepository;
use App\Validators\PostValidator;
use UUID;

class TestController extends ApiController
{
//    protected $repository;
//    protected $validator;
//
//    public function __construct(PostRepository $repository, PostValidator $validator)
//    {
//        $this->repository = $repository;
//        $this->validator  = $validator;
//    }

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //
        return $this->message('aaa');
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }


    public function store(OrderDistributionTimeService $distributionTimeService, CategoryFactory $categoryFactory)
    {

        return $categoryFactory->getList(3);
        $res = DB::table('cart')->where(['rec_id'=>8444])->increment('goods_id', 10);
        print_r($res);

        $test = DB::table('cart')->orderBy('goods_id', 'asc')->select(['goods_id','goods_sn','rec_id'])->where(['user_id'=>5761])->get();

        return $test;
        return 12;

        return $distributionTimeService->getDistributieTime(12, 7);
        //return $deliverRegionOrderPeakService->getOrderPeakByWdrId(7);

       /* $keyword = '';
        //$goodsSearchService->setKeword($keyword);
        //$goodsSearchService->setCatId(179);
        //$goodsSearchService->brand_id = 1611;
        //$goodsSearchService->origin = '中国';
        //$goodsSearchService->sort_field = 'shop_price';

        $params = [
            'wid' => '8',
            'keyword' => '牛肉',
            'userRank' => '',
            'catIdList' => '',
            'catId' => '',
            'catChildId' => '',
            'origin' => '',
            'brandId' => '',
            'sortField' => '',
            'sortType' => '',
            'startOffset' => '',
        ];

        $goodsSearchService->config($params);

        $res['goods_list'] = $goodsSearchService->getSearchGoodsList();

        $res['brand_list'] = $goodsSearchService->getBrandList();

        $res['origin_list'] = $goodsSearchService->getOriginList();
        $res['category_list'] = $goodsSearchService->getCategoryId();
        $res['cat_child_list'] = $goodsSearchService->getCategoryId('get_son_category');
        return $res;*/
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}
